﻿@page "/Archive/Manufacturer/ViewIndex"
@page "/Archive/Manufacturer/ViewIndex/{Token}"
@using iTeamyou.LTS.UI.Models;
@using iTeamyou.LTS.UI.Shared.Components.Mobile;

<h5 style="margin-top: 1.5rem;">生产商查询</h5>
<Table style="margin-top: 1rem;" TItem="Core.Models.Manufacturer"
       IsPagination="true" PageItemsSource="@PageItemsSource" IsStriped="true" ShowLineNo="false"
       CustomerSearchModel="@ManufacturerSearchModel" SearchMode="SearchMode.Top" ShowSearchText="true" ShowSearch="true"
       OnDoubleClickRowCallback="@View"
       ShowSkeleton="true" ShowResetButton="true" ShowEmpty="true"
       OnQueryAsync="@OnQueryAsync" IsAutoRefresh="@IsAutoRefresh" AutoRefreshInterval="2000">
    <TableColumns>
        <TableColumn @bind-Field="@context.MId" Width="80" />
        <TableColumn @bind-Field="@context.Name" Width="200" />
        <TableColumn @bind-Field="@context.ProductType" Width="100" />
        <TableColumn @bind-Field="@context.Register" Width="100" />
        <TableColumn @bind-Field="@context.ResponsiblePerson" Width="100" />
        <TableColumn @bind-Field="@context.CreatedOn" Width="80" Sortable="true" />
        <TableColumn @bind-Field="@context.LastModifiedOn" Width="80" Sortable="true" />
        <TableColumn @bind-Field="@context.LicenseNum" Width="80" Text="证照数">
            <Template Context="value">
                @if (value.Value == 0)
                {
                    <Tag Color="Color.Dark">共 0 个证照</Tag>
                }
                else
                {
                    <Tag Color="Color.Primary">共 @value.Value 个证照</Tag>
                }
            </Template>
        </TableColumn>
        @*<TableColumn @bind-Field="@context.Id" Text="操作">
            <Template Context="value">
                <Button Text="查看" OnClick="@(() => View(value.Value))" />
            </Template>
        </TableColumn>*@
    </TableColumns>
    <CustomerSearchTemplate>
        @if (context is ManufacturerSearchModel model)
        {
            <ManufacturerMobileSearch @bind-Value="@model" />
        }
    </CustomerSearchTemplate>
</Table>